<template>
  <div>
    <Phead />
    <Pmsg />
      <div class="personal-content w clearfix">
        <Pmy />

        <div class="right myorder">
            <!-- 个人中心tab切换栏 -->
            <h3 class="stamp">我的订单</h3>
            <ul class="change clearfix">
                <li :class="{active:tab == 0}" @click="tabList" data-index="0">招标中</li>
                <li :class="{active:tab == 1}"  @click="tabList" data-index="1">已中标</li>
                <li :class="{active:tab == 2}"  @click="tabList" data-index="2">未中标</li>
                <li :class="{active:tab == 3}"  @click="tabList" data-index="3">报价人数不足</li>
                <li :class="{active:tab == 4}"  @click="tabList" data-index="4">效益作废</li>
                <li :class="{active:tab == 5}"  @click="tabList" data-index="5">拒收</li>
                <li :class="{active:tab == 6}"  @click="tabList" data-index="6">等待确认结果</li>
                <li :class="{active:tab == 7}"  @click="tabList" data-index="7">成交</li>
            </ul>

            <!-- 个人中心 -->
            <div class="tabulation">

                <!-- 个人中心 > 我的订单 > 招标中 -->
                <div class="ul1 item">
                    <ul>
                        <li v-for="(val,index) in bidList" :key="index">
                            <a href="#" :data-bidid="val.bid_id" @click="toDetail">
                                <span>({{val.bid_type}})</span>
                                <em>{{val.bid_name}}</em>

                                <button :data-bidId="val.bid_id" :data-id="index" type="primary" size="mini" plain="true" @click.stop="istrue"  v-if="val.is_true==0">确认</button>
                                <button class="whitebtn" disabled="true" type="primary" size="mini" plain="true" v-if="val.is_true==1">已确认</button>


                                <i class="fr">
                                <em></em>{{val.city_id}}</i>
                                <h4>
                                  {{val.bid_remark}}
                                </h4>
                                <tbody>
                                    <table>
                                        <tr>
                                            <td class="green">
                                              <span>{{val.time}}</span>
                                            </td>
                                            <td>
                                              <em>{{val.bid_user_company}}</em>
                                            </td>
                                            <td>
                                              <em>{{val.bid_enlist_num}}人</em>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>时间</td>
                                            <td>发布者</td>

                                            <td>竞标</td>
                                        </tr>
                                    </table>
                                </tbody>
                            </a>
                        </li>
                        
                    </ul>
                    <!-- <div class="clearfix">
                        <div class="page">
                            <a href="" class="active">上一页</a>
                            <a href="">1</a>
                            <a href="">2</a>
                            <a href="">3</a>
                            <a href="">4</a>
                            <a href="">5</a>
                            <a href="">下一页</a>
                            <i>跳转到<input type="text">页</i>
                        </div>
                    </div> -->
                </div>


            </div>
        </div>
      </div>

    <Pfoot />
  </div>

  <!-- <div class="wrap w-order detail w-index">
    
        <div class="tab">
              <div class="con con1 con2 con3" style="display: block;" v-for="(val,index) in bidList" :key="index">
                <div class="item" :data-bidid="val.bid_id" @click="toDetail">
                  <div class="name clearfix">
                    <div class="flag">{{val.bid_type}}</div>
                    <h3>{{val.bid_name}}</h3>

                    <button :data-bidId="val.bid_id" :data-id="index" type="primary" size="mini" plain="true" @click.stop="istrue"  v-if="val.is_true==0">确认</button>
                    <button disabled="true" type="primary" size="mini" plain="true" v-if="val.is_true==1">已确认</button>

                  </div>
                  <div class="text">
                    <div :class="!val.show_remark ? 'font' : 'font show-text'">
                    {{val.bid_remark}}
                    </div>
                    <div :class="!val.show_remark ? 'icon' : 'icon show-text'" @click.stop="showTxt(index)">
                        <img :src="!val.show_remark ? up_img : down_img" alt="" />
                    </div>
                  </div>
                  <div class="infos clearfix">
                    <div class="right">
                        <div class="list">
                            发布者：{{val.bid_user_company}}
                        </div>
                        <div class="list">
                            竞标人数：{{val.bid_enlist_num}}
                        </div>
                        <div class="list">
                            位置：{{val.city_id}}
                        </div>
                        <div class="list">
                            日期：{{val.time}}
                        </div>
                    </div>
                  </div>
                </div>
              </div>
          </div>

    </div>


 </div> -->

</template>
<script>
import Phead from '@/components/Phead.vue'
import Pfoot from '@/components/Pfoot.vue'
import Pmy from '@/components/Pmy.vue'
import Pmsg from '@/components/Pmsg.vue'

export default {
  data(){
    return{
      is_show:true,

      bidList:{},
      tab:0,
      currentTab: 0, //导航菜单使用数据
      navScrollLeft: 0, //导航菜单使用数据
      lts2: {},
      isNull: true,

    }
  },
  async created(){
        let user_token = this.getUserToken()
        let tab = this.$route.query.id?this.$route.query.id:0;

        let re = await this.$axios.post('bid/statusBidList',{
          user_token:user_token,
          tab:tab
        })
        if(re.code == 200){
           this.bidList = re.data
        }
    
  },
  methods:{
    //确认按钮
   async istrue(e){
        let bidid = e.currentTarget.getAttribute('data-bidid')
        let id = e.currentTarget.getAttribute('data-id')
        let arr = this.bidList;

        let res = await this.$axios.post('bid/isTrue',{
          bid_id:bidid
        })
        if(res.code == 200){
            arr[id].is_true = 1
            this.bidList = arr
        }
    },
    //标书详情
    async toDetail(e){
      let that =this;
      let bidid = e.currentTarget.getAttribute('data-bidid')
      //let  tabnum  =  e.currentTarget.dataset.tabnum;
      let user_token = this.getUserToken()
      let res = await this.$axios.post('bid/getGoWhere',{
          bid_id:bidid,
          user_token:user_token
        })
          if(res.code == 200){
              this.$router.push({path:'/bid/'+res.data.toWhere,query: {
              bid_id: bidid,
              redirect:'/my/bidlist'
             }})
          }
          
     },

    //tab 切换
    async tabList(e){
        let user_token = this.getUserToken()
        this.tab = e.target.getAttribute('data-index');

        let re = await this.$axios.post('bid/statusBidList',{
          user_token:user_token,
          tab:this.tab
        })
        if(re.code == 200){
           this.bidList = re.data
        }
              
        

    },
  
  },
  mounted(){
      
        
    
  },
  components: {
     Phead,
     Pfoot,
     Pmy,
     Pmsg
  }
}
</script>
